import requests
from bs4 import BeautifulSoup
import json

url = "https://mp.weixin.qq.com/s/el_coQ5xYnJ6WIbss4l5Tw"

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.1100 Safari/537.3"
}

response = requests.get(url, headers=headers)

# 检查是否请求成功
if response.status_code == 200:
    # 使用BeautifulSoup解析网页内容
    soup = BeautifulSoup(response.text, 'html.parser')

    # 假设我们要抓取文章的标题，通常在微信公众号文章页面，正文内容可能不在直接的HTML中
    # 这里仅作为示例，实际可能需要根据页面结构调整选择器
    try:
        title = soup.find('h1', class_='rich_media_title').text.strip()  # 注意这里的类名需根据实际页面检查后确定
        print("文章标题:", title)
    except AttributeError:
        print("未找到文章标题")

else:
    print("请求失败，状态码：", response.status_code)